function plotseiswave(d, offset, dt, norm, type, axh)
% plotseiswave(data, traceheader, dt, normalizeType, figureType, fighandle)
%     data: matrix
%     traceheader: struct
%     dt: sampling interval
%     normalizeType: 'none'/'trace'/'gather'
%     figureType: 'line'/'image'
%     fighandle: specify figure

if nargin < 6
    figure;
    axh = axes;
end
if nargin < 5
    type = 'image';
end
if nargin < 4
    norm = 'none';
end
minoffset = max(abs(diff(sort(offset))));
switch norm
    case 'trace'
        nd = zeros(size(d));
        for i = 1:size(d, 2)
            nd(:, i) = d(:, i)/max(abs(d(:,i)));
        end
    case 'gather'
        nd = d/max(abs(d(:)));
    otherwise
        nd = d;
end
switch type
    case 'line'
        for i = 1:length(offset)
            shift = offset(i)/minoffset;
            line(axh, nd(:, i)+shift, (0:size(d, 1)-1)*dt, 'Color', 'k', 'LineStyle', '-');
        end
    otherwise
        [~, idx] = sort(offset);
        imagesc(axh, [min(offset), max(offset)], [0, (size(d, 1)-1)*dt], nd(:, idx));
end
set(axh, 'YDir', 'reverse', 'Box', 'on');
end